#pragma once

#include "Block.h"
#include "Player.h"
#include "Combo.h"
#include <vector>
#include <map>

class Engine{
	struct player_cmp
	{
		bool operator() (const Player lhs, const Player rhs) const
		{
			return lhs.GetPlayerIndex() < rhs.GetPlayerIndex();
		}
	};
	typedef std::map<Player, std::vector<Block>, player_cmp> Dict_Combo;
	

public:
	static Engine *GetInstance();
	bool HasCombos(Scene *scene);

private:
	Engine(){};
	static Engine* _engine;
	Dict_Combo combos;

	void Combos(Player player, Scene *scene);

	bool HasFriendInLine(Player player, Block mainBlock, int blocksInCombo);
	bool HasFriendInCol(Player player, Block mainBlock, int blocksInCombo);
	bool IsBlockInCombo(Block *block, Player player);
};